package com.spzx.JUC3.test1;

import java.util.concurrent.CountDownLatch;

public class CountDownLatchThread01 implements Runnable{

    //private  'Conut'DownLatch conutDownLatch;
    // CountDownLatch类型成员变量
    private CountDownLatch countDownLatch ;

    public CountDownLatchThread01(CountDownLatch countDownLatch){
        //构造方法
        this.countDownLatch = countDownLatch;
    }
    @Override
    public void run() {

        try {
            Thread.sleep(10000);
            System.out.println("10秒以后执行了CountDownLatchThread01......");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        //调用CountDownLatch对象的countdown方法对计数器进行-1操作
        countDownLatch.countDown();
    }
}
